package com.coollang.smartbra.views;

import android.animation.ValueAnimator;
import android.graphics.Rect;

import com.github.ybq.android.spinkit.animation.SpriteAnimatorBuilder;
import com.github.ybq.android.spinkit.sprite.CircleSprite;
import com.github.ybq.android.spinkit.sprite.Sprite;
import com.github.ybq.android.spinkit.sprite.SpriteGroup;

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
public class FiveBounce extends SpriteGroup {
    public FiveBounce() {
    }

    public Sprite[] onCreateChild() {
        return new Sprite[]{new Bounce(), new Bounce(), new Bounce(), new Bounce(), new Bounce()};
    }

    public void onChildCreated(Sprite... sprites) {
        super.onChildCreated(sprites);
        sprites[1].setAnimationDelay(160);
        sprites[2].setAnimationDelay(320);
        sprites[3].setAnimationDelay(480);
        sprites[4].setAnimationDelay(640);
    }

    protected void onBoundsChange(Rect bounds) {
        super.onBoundsChange(bounds);
        bounds = this.clipSquare(bounds);
        int radius = bounds.width() / 8;
        int top = bounds.centerY() - radius;
        int bottom = bounds.centerY() + radius;
        for (int i = 0; i < this.getChildCount(); ++i) {
            int left = bounds.left + bounds.width() * i / 3;
            this.getChildAt(i).setDrawBounds(left + radius * ((2 * i) - 6), top, left + radius * ((2 * i) - 4), bottom);
        }
    }

    class Bounce extends CircleSprite {
        public Bounce() {
            this.setScale(0.0F);
        }

        public ValueAnimator getAnimation() {
            float[] fractions = new float[]{0.0F, 0.4F, 0.8F, 1.0F};
            return (new SpriteAnimatorBuilder(this)).scale(fractions, new float[]{0.0F, 1.0F, 0.0F, 0.0F}).duration(1400L).easeInOut(fractions).build();
        }
    }
}

